Mapa oboljelih

Row

Samoizolacija

6278

COVID-19 slucajevi

91

Umrli

2

Row

Mapa

Novi COVID-19 slucajevi

Podaci JIZCG

Row

Evolucija COVID-19 slucajeva

Indeksni/Kontakti slucajevi

Row

Stopa rasta novih COVID-19 slucajeva

Novi COVID-19 slucajevi

Mapa svijeta

Map

SIR Model - Test

About

The Coronavirus Dashboard

This Coronavirus dashboard provides an overview of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic. This dashboard is built with R using the Rmakrdown framework and can easily reproduce by others. The code behind the dashboard available here

Data

The input data for this dashboard is the Public Health Institute of Montenegro (IJZCG) official data.. The data and dashboard is refreshed on a daily bases. The raw data is available here

Packages

Deployment and reproducibly

The dashboard was deployed to Github docs. If you wish to deploy and/or modify the dashboard on your Github account, you can apply the following steps:

For any question or feedback, you can either open an issue or contact me on Twitter.

Contribution

The Map tab was contributed by Art Steinmetz on this pull request. Thanks Art!

---
title: "Crna Gora COVID-19"
featuredImage: "Users/Dovla/Desktop/img.png"
author: "W"
output: 
  flexdashboard::flex_dashboard:
    theme: cosmo
    orientation: rows
    social: menu
    source_code: embed

---

```{r setup, include=FALSE}
library(ggplot2)
library(plotly)
library(plyr)
library(flexdashboard)
library(tidyverse)
library(leaflet)
library(stringr)
library(sf)
library(here)
library(widgetframe)
library(tidyr)
library(DT)
mne <- read.csv("/Users/Dovla/Desktop/covidMNE2703.csv")
```

Mapa oboljelih
=======================================================================

Row
-----------------------------------------------------------------------

### Samoizolacija

```{r}
articles <- 6278
valueBox(articles, icon = "fa-home", color = "success")
```

### COVID-19 slucajevi

```{r}
comments <- 91
valueBox(comments, icon = "fa-notes-medical", color = "warning")
```

### Umrli

```{r}
spam <- 2
valueBox(spam, 
         icon = "fa-battery-empty",
         color = "danger")
```

Row 
-----------------------------------------------------------------------

### Mapa

```{r,fig.width = 12, echo=FALSE, warning=FALSE}
gra <- data.frame("gr"=c("Tuzi","Podgorica","Ulcinj","Andrijevica","Bar","Budva","Herceg Novi","Danilovgrad","Tivat"),"nr" = c(32,30,7,6,6,4,4,1,1))
b <-c ()
for(i in 1:nrow(gra)) {
  b <- c(b,rep(paste0(gra$gr[i]),gra$nr[i]))
}
gra2 <- data.frame(unlist(b))
colnames(gra2) <- "gr"
grad <- read.csv("/Users/Dovla/Desktop/grad.csv")
grad1 <- unique(grad)
mapa <- left_join(gra2, grad1, by = c("gr" = "Grad"))


#mapa <- na.omit(read.csv("/Users/Dovla/Desktop/grad.csv"))

m <- leaflet() %>%
  addTiles(urlTemplate = 'https://{s}.tile.thunderforest.com/pioneer/{z}/{x}/{y}.png') 
#m %>%
#  frameWidget()
leaflet(data = mapa) %>%
  addTiles() %>%
  addMarkers(clusterOptions = markerClusterOptions())  #%>%  frameWidget()
```

### Novi COVID-19 slucajevi

```{r}
mne22 <- subset(mne[mne$InfectedNew>0,])
p3 <- ggplot(data=mne22, aes(x=Day, y=InfectedNew)) + geom_bar(stat="identity",color="red", fill="white") +
  labs(x="Dana od 9/3 tj epidemije", y = "Novih slucajeva") + coord_flip()
ggplotly(p3) 
```

Podaci JIZCG
=======================================================================

Row
-----------------------------------------------------------------------

### Evolucija COVID-19 slucajeva 

```{r}

mne <- read.csv("/Users/Dovla/Desktop/covidMNE2703.csv")
mne$InfectionRate1 <- as.numeric(levels(mne$InfectionRate))[mne$InfectionRate]
myvars <- c("Day","Infected", "Tested")#, "UnderWatch")
mne1 <- mne[myvars]
#mne1$UnderWatch <- mne1$UnderWatch/10
names(mne1) <- c("Day","covid-19", "Testirano")#, "Izolacija / 10")
mne2 <- mne1 %>%
  pivot_longer(-Day, names_to = "Legenda", values_to = "count")

p11 <- ggplot(mne2, aes(x=Day, y=count,group = Legenda)) + geom_line(aes(linetype=Legenda)) + geom_point() +
    labs(x = "Proslo dana od 09/03/2020 tj prvog dana izvjestavanja o CG", y = "") 
#p11 <- ggplot(mne2, aes(x=Day, y=count, col=series)) + geom_line() + geom_point()
ggplotly(p11)

```

### Indeksni/Kontakti slucajevi

```{r,echo=FALSE, warning=FALSE}
library(igraph)
library(sna)
library(GGally)

gra <- read.csv("/Users/Dovla/Desktop/gra.csv")
graC <- read.csv("/Users/Dovla/Desktop/nodCol.csv")
g1 <- graph.data.frame(gra, directed=FALSE)
V(g1)$color <- "red"
V(g1)[gra$e]$color = "green"


#plot(g1, vertex.size = 10, edge.size=0.1, edge.color = "black", lty = 0, arrow.mode=3, arrow.size = 3, main="MNE covid19 clusters 29/03/2020")

#library(visNetwork)
#visIgraph(g1)

g2 <- ggnet2(g1,label = TRUE, label.size = 3, label.color="black",layout.par = list(cell.jitter = 0.75), 
             size = as.character(graC$s), size.palette = c("lar" = 8, "sma" = 3),
             shape = as.character(graC$s),
             node.color = c(rep("red",22),rep("darkgreen",62)),
             legend.size = 5)

ggplotly(g2)
```

Row
-----------------------------------------------------------------------

### Stopa rasta novih COVID-19 slucajeva

```{r}
p2 <- ggplot(data=mne, aes(x=Day, y=InfectionRate1*100, group=1)) + geom_line(linetype = "dashed", colour="red") +
  geom_point() +
  labs(x = "Proslo dana od 09/03/2020 tj prvog dana izvjestavanja o CG", y = "Stopa u %") 
ggplotly(p2)

```


### Novi COVID-19 slucajevi

```{r}
p3 <- ggplot(data=mne, aes(x=Day, y=InfectedNew)) + geom_bar(stat="identity",color="red", fill="white") +
  labs(x = "Proslo dana od 09/03/2020 tj prvog dana izvjestavanja o CG", y = "Novih slucajeva") 
ggplotly(p3)
```

Mapa svijeta
=======================================================================

**Map**

```{r}
# map tab added by Art Steinmetz
library(leaflet)
library(leafpop)
library(purrr)
library(coronavirus)
data(coronavirus)

cv_data_for_plot <- coronavirus %>% 
  dplyr::filter(cases > 0) %>% 
  dplyr::group_by(Country.Region,Province.State,Lat,Long,type) %>% 
  dplyr::summarise(cases = sum(cases)) %>% 
  dplyr::mutate(log_cases = 2 * log(cases)) %>% 
  dplyr::ungroup()
cv_data_for_plot.split <- cv_data_for_plot %>% split(cv_data_for_plot$type)
pal <- colorFactor(c("orange", "red","green"), domain = c("confirmed", "death","recovered"))
map_object <- leaflet() %>% addProviderTiles(providers$Stamen.Toner)
names(cv_data_for_plot.split) %>%
  purrr::walk( function(df) {
    map_object <<- map_object %>%
      addCircleMarkers(data=cv_data_for_plot.split[[df]],
                 lng=~Long, lat=~Lat,
#                 label=~as.character(cases),
                 color = ~pal(type),
                 stroke = FALSE,
                 fillOpacity = 0.8,
                 radius = ~log_cases,
                 popup =  leafpop::popupTable(cv_data_for_plot.split[[df]],
                                              feature.id = FALSE,
                                              row.numbers = FALSE,
                                              zcol=c("type","cases","Country.Region","Province.State")),
                 group = df,
#                 clusterOptions = markerClusterOptions(removeOutsideVisibleBounds = F),
                 labelOptions = labelOptions(noHide = F,
                                             direction = 'auto'))
  })
map_object %>%
  addLayersControl(
    overlayGroups = names(cv_data_for_plot.split),
    options = layersControlOptions(collapsed = FALSE) 
  )
```

SIR Model - Test
=======================================================================



About
=======================================================================

**The Coronavirus Dashboard**

This Coronavirus dashboard provides an overview of the 2019 Novel Coronavirus COVID-19 (2019-nCoV) epidemic. This dashboard is built with R using the Rmakrdown framework and can easily reproduce by others. The code behind the dashboard available [here](https://github.com/0x3w/covid19-mne)

**Data**

The input data for this dashboard is the [Public Health Institute of Montenegro (IJZCG)](https://www.ijzcg.me/me/novosti/azurirani-podaci-o-novom-koronavirusu-2019-ncov) official data.. The data and dashboard is refreshed on a daily bases. The raw data is available [here](https://github.com/0x3W/covid19-me)


**Packages**

* Dashboard interface - the [flexdashboard](https://rmarkdown.rstudio.com/flexdashboard/) package. 
* Visualization - the [plotly](https://plot.ly/r/) package for the plots and [leaflet](https://rstudio.github.io/leaflet/) for the map
* Data manipulation - [dplyr](https://dplyr.tidyverse.org/), and [tidyr](https://tidyr.tidyverse.org/)
* Tables - the [DT](https://rstudio.github.io/DT/) package

**Deployment and reproducibly**

The dashboard was deployed to Github docs. If you wish to deploy and/or modify the dashboard on your Github account, you can apply the following steps:

* Fork the dashboard [repository](https://github.com/0x3w/covid19-mne), or
* Clone it and push it to your Github package
* Here some general guidance about deployment of flexdashboard on Github page - [link](https://github.com/pbatey/flexdashboard-example)

For any question or feedback, you can either open an [issue](https://github.com/0x3W/covid19-mne/issues) or contact me on [Twitter](https://twitter.com/praeconium).

**Contribution** 

The **Map** tab was contributed by [Art Steinmetz](@adababbage) on this [pull request](https://github.com/RamiKrispin/coronavirus_dashboard/pull/1). Thanks Art!